import {createRouter, createWebHistory, RouteRecordRaw} from "vue-router";

// modules下的 .ts --》default
let modules = import.meta.glob('./modules/*.ts', {eager: true, import: 'default'});

const routes: RouteRecordRaw[] = []
for (let entry of Object.values(modules)) {
    routes.push(entry as RouteRecordRaw) //Object --> RouteRecordRaw
}
console.log(routes)

export const routesInfo = routes;

const routerInfo = createRouter({
    history: createWebHistory('/'),
    routes: routes as RouteRecordRaw[],
    strict: false,
    scrollBehavior: () => ({left: 0, top: 0})
});
export default routerInfo;

